<?php
	class News extends CI_Controller
	{
		function __construct()
		{
			parent::__construct();
		}
		
		function Index($pagen=0)
		{
			$this->load->database();
			$this->load->model('mnews');
			$this->load->library('pagination');
			$config['base_url'] = site_url().'news/p';
		    $config['total_rows'] = $this->mnews->getTotal();
		    $config['per_page'] = 12;
		    $config['uri_segment'] = 3; 
		    $config['num_links'] = 3;
	      	$config['first_link'] = '首页';
	      	$config['next_link'] = '下一页';
	      	$config['prev_link'] = '上一页';
	      	$config['last_link'] = '尾页';
	      	$this->pagination->initialize($config);
	      	$pagen = $this->uri->segment(3);
	      	if($pagen==0)
	      	{
	      		$pagen=0;
	      	}
	      	else
	      	{
	      		$pagen=$pagen-1;
	      	}
			$res=$this->mnews->getList($pagen,$config['per_page']);
			$data=array('pageTitle'=>'新闻',
						'bread'=>'新闻',
						'menuIdx'=>0,
						'res'=>$res,
						'productTid'=>0,
						'hornorTid'=>0,
						'pagebar'=>$this->pagination->create_links());
			$this->load->view('news.html',$data);
		}
		
		
		function view($id)
		{
			$this->load->model('mnews');
			$item = $this->mnews->getItem($id);
			$data=array('pageTitle'=>'新闻',
						'bread'=>'新闻',
						'menuIdx'=>0,
						'news'=>$item,
						'productTid'=>0,
						'hornorTid'=>0);
			$this->load->view('news-1.html',$data);
		}
	}
/* End of file */